import { Config } from '../cors/config';
import { BaseCommand } from '../types/common.interface';
import { RenderTrigger } from '../cors/render-trigger';
export class HiddenRowCommand extends BaseCommand {
    protected pastHiddenRows: number[] = [];
    constructor(
        protected conf: Config,
        protected render: RenderTrigger,
        protected rows: number[],
        protected type: 'add'|'remove'
        
    ) {
        super();
    }
    execute(): boolean {
        // this.conf.hiddenRows.add(this.row)
        this.pastHiddenRows = Array.from(this.conf.hiddenRows);
        for(let row of this.rows) {
            if(this.type === 'add') {
                this.conf.hiddenRows.add(row);
            } else {
                this.conf.hiddenRows.delete(row);
            }
        }
        this.render.triggerRenderAll();
        return true;
    }
    redo(): boolean {
        this.conf.hiddenRows.clear();
        for(let row of this.pastHiddenRows) {
            this.conf.hiddenRows.add(row);
        }
        this.render.triggerRenderAll();
        return true;
    }
} 